import java.util.HashMap;
import java.util.Map;

public class Dictionary {

    private Map<String, String> dictionary;

    public Dictionary() {
        dictionary = new HashMap<>();
        dictionary.put("你好", "Hello");
        dictionary.put("再见", "Goodbye");

    }

    public String translateToEnglish(String chinese) {
        return dictionary.getOrDefault(chinese, "未找到对应英文");
    }

    public String translateToChinese(String english) {
        for (Map.Entry<String, String> entry : dictionary.entrySet()) {
            if (entry.getValue().equalsIgnoreCase(english)) {
                return entry.getKey();
            }
        }
        return "未找到对应中文";
    }

    public static void main(String[] args) {
        Dictionary dictionary = new Dictionary();

        System.out.println("翻译'你好'到英文: " + dictionary.translateToEnglish("你好"));
        System.out.println("翻译'世界'到英文: " + dictionary.translateToEnglish("世界"));

        System.out.println("翻译'Hello'到中文: " + dictionary.translateToChinese("Hello"));
        System.out.println("翻译'World'到中文: " + dictionary.translateToChinese("World"));
    }
}
